home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / Draw / Sources / LineShp.h < prev    next >
Encoding:
Text File  |  1996-09-17  |  2.7 KB  |  101 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                LineShp.h
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Author:                Henri Lamiraux
  7. //
  8. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  9. //
  10. //========================================================================================
  11.  
  12. #ifndef LINESHP_H
  13. #define LINESHP_H
  14.  
  15. #ifndef CONSTANT_H
  16. #include "Constant.h"
  17. #endif
  18.  
  19. #ifndef BASESHP_H
  20. #include "BaseShp.h"
  21. #endif
  22.  
  23. // ----- OS Layer -----
  24.  
  25. #ifndef FWPOINT_H
  26. #include "FWPoint.h"
  27. #endif
  28.  
  29. #ifndef FWRECT_H
  30. #include "FWRect.h"
  31. #endif
  32.  
  33. // ----- Foundation Layer -----
  34.  
  35. #ifndef FWRUNTYP_H
  36. #include "FWRunTyp.h"
  37. #endif
  38.  
  39. //========================================================================================
  40. // class CLineShape
  41. //========================================================================================
  42.  
  43. class CLineShape : public CBaseShape
  44. {
  45. public:
  46.     FW_DECLARE_CLASS
  47.     FW_DECLARE_AUTO(CLineShape)
  48.  
  49. public:
  50.     CLineShape(CDrawPart* drawPart);
  51.     CLineShape(CDrawPart* drawPart, FW_CReadableStream& archive);
  52.     virtual ~CLineShape();
  53.         
  54.     // ----- Geometry
  55.     virtual void        SetShapeGeometry(const FW_CPoint& anchorPoint,  const FW_CPoint& currentPoint);
  56.     virtual ODShape*    CreateShapeOutline(Environment *ev);
  57.     virtual ODShape*    CalcClipShape(Environment* ev);
  58.     virtual FW_CRect    GetRectGeometry() const;
  59.     
  60.     FW_CPoint            GetLineStart() const
  61.                             {return fStart;}
  62.     FW_CPoint            GetLineEnd() const
  63.                             {return fEnd;}
  64.                             
  65.     // ----- Selection
  66.     virtual FW_Boolean    HitTest(Environment *ev, FW_CGraphicContext& gc, const FW_CMouseEvent& theMouseEvent) const;
  67.     
  68.     // ----- Dragging
  69.     virtual void        OffsetShape(Environment *ev, FW_Fixed xDelta, FW_Fixed yDelta);
  70.  
  71.     // ----- Resize
  72.     virtual void        ResizeFeedback(FW_CGraphicContext& gc, const FW_CInk& ink, const FW_CStyle& style, 
  73.                                         short whichHandle, const FW_CPoint& mouseLoc);
  74.     virtual void        GetMapRects(short whichHandle, const FW_CPoint& lastLocation,
  75.                                     FW_CRect& srcRect, FW_CRect& dstRect);
  76.     virtual void        GetHandleCenter(short whichHandle, FW_CPoint& center) const;
  77.     virtual void        MapShape(Environment *ev, const FW_CRect& srcRect, const FW_CRect& dstRect);
  78.     
  79.     // ----- Drawing
  80.     virtual void         RenderShape(Environment* ev, ODFacet* facet, FW_CGraphicContext& gc);
  81.  
  82.     // ----- Persistence
  83.     virtual void         Flatten(FW_CWritableStream& archive);
  84.     
  85.     // ----- Archiving -----
  86.     static void*         Read(FW_CReadableStream& stream, FW_ClassTypeConstant type);
  87.  
  88.     // ----- Scripting -----
  89.     virtual ODDescType    GetObjectClass() const;
  90.  
  91. private:
  92.     void                 OutlineShape(FW_CGraphicContext& gc, const FW_CInk& ink, const FW_CStyle& style, 
  93.                                      const FW_CPoint& pt1, const FW_CPoint& pt2);
  94.  
  95. private:
  96.     FW_CPoint            fStart;
  97.     FW_CPoint            fEnd;
  98. };
  99.  
  100. #endif
  101.